package hzst.android.form.view;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.TextView;

public class FMTextView extends FMBaseView{

	public FMTextView(Context context) {
		super(context);
	}

	@Override
	protected void initView() {
	}
	
	@Override
	public void showView() {
		TextView tv = new TextView(context);
		tv.setTextSize(18);
		String value = info.getSubmitValues().get(0).getValue();//文本只有一个value
		tv.setText(value);
		if(info.isReadOnly()){
			tv.setEnabled(false);
		}
		tv.addTextChangedListener(new TextWatcher() {
			@Override
			public void onTextChanged(CharSequence s, int start, int before, int count) {
				
			}
			
			@Override
			public void beforeTextChanged(CharSequence s, int start, int count,
					int after) {
				
			}
			
			@Override
			public void afterTextChanged(Editable s) {
				viewCreator.setSubmitValue(s.toString(), info);
//				viewCreator.updateViewInfo(info, true);
			}
		});
		addView(tv);
		
	}

}
